package com.lxh.cp.builder;

import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpXmlMessage;
import me.chanjar.weixin.cp.bean.WxCpXmlOutMessage;
import me.chanjar.weixin.cp.bean.WxCpXmlOutNewsMessage;
import me.chanjar.weixin.cp.bean.WxCpXmlOutTextMessage;
import me.chanjar.weixin.cp.bean.article.NewArticle;

/**
 * created by lanxinghua@2dfire.com on 2020/2/23
 */
public class NewsBuilder extends AbstractBuilder {

    @Override
    public WxCpXmlOutMessage build(String content,
                                   WxCpXmlMessage wxMessage,
                                   WxCpService service) {

        WxCpXmlOutNewsMessage.Item item1 = new WxCpXmlOutNewsMessage.Item();
        item1.setUrl("URL");
        item1.setPicUrl("PIC_URL");
        item1.setDescription("Is Really A Happy Day");
        item1.setTitle("Happy Day");

        WxCpXmlOutNewsMessage.Item item2 = new WxCpXmlOutNewsMessage.Item();
        item2.setUrl("URL");
        item2.setPicUrl("PIC_URL");
        item2.setDescription("Is Really A Happy Day");
        item2.setTitle("Happy Day");
        WxCpXmlOutNewsMessage m = WxCpXmlOutMessage.NEWS()
                .addArticle(item2)
                .addArticle(item2)
                .fromUser(wxMessage.getToUserName())
                .toUser(wxMessage.getFromUserName())
                .build();
        return m;
    }

}
